<?php
require_once './header.php';
require_once './core/sql.php';
$sql = new SqlS();

?>
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=0,maximum-scale=1.0"/>
        <title>自定义问题</title>
        <link rel="stylesheet" href="./css/base.css">
        <link rel="stylesheet" href="./css/index.css">
        <link rel="stylesheet" href="./admin/css/jquery.xctips.css"/>
        <script>
            function adapte() {//适配
                var designWidth = 1080, rem2px = 100;
                document.documentElement.style.fontSize = window.innerWidth / designWidth * rem2px + "px";
            }
            adapte();
        </script>
    </head>
    <body>
    <?php
    if (isset($_GET['quId'])) {
    //如果是设定了问题id
    $quId = $_GET['quId'];
    $all_array = $sql->seSelectDiyQuCo($quId);
    list($quName, $quShow, $quType, $quModes) = $all_array;
    $quModes_array = json_decode($quModes, JSON_UNESCAPED_UNICODE);
    $count_quModes = count($quModes_array);
    if ($quShow == 1) {
        // 表示不是填空
    ?>
    <div class="make-problem">
        <div class="top">
            <p class="fs36"><span>输入问题</span>
                <input type="text" value="<?= $quName ?>">
            </p>
            <p class="clearfix">
                <span class="fl fs36">是否填写</span>
                <span class="switch fr switch-close"></span>
            </p>
        </div>
        <div class="bottom fs36" style="display: none;">
            <?php
            } elseif ($quShow == 0) {
        // 表示是填空
            ?>
            <div class="make-problem">
                <div class="top">
                    <p class="fs36"><span>输入问题</span>
                        <input type="text" value="<?= $quName ?>">
                    </p>
                    <p class="clearfix">
                        <span class="fl fs36">是否填写</span>
                        <span class="switch fr"></span>
                    </p>
                </div>
                <div class="bottom fs36">
                    <?php
                    }
                    ?>
                    <span>填写方式</span>
                    <div class="radio">
                        <?php
                        if ($quType == 1) {
                            ?>
                            <span class="active a">单选</span>
                            <?php
                        } else {
                            ?>
                            <span class="a">单选</span>
                            <?php
                        }
                        if ($quType == 2) {
                            ?>
                            <span class="active b">多选</span>
                            <?php
                        } else {
                            ?>
                            <span class="b">多选</span>
                            <?php
                        }
                        ?>
                    </div>
                    <ul class="lists flex">
                        <?php
                        for ($i = 0; $i < 10; $i++) {
                            if ($i < $count_quModes) {
                                ?>
                                <li>
                                    <span><?= $i + 1 ?></span>
                                    <input type="text" placeholder="请填写可选答案" value="<?= $quModes_array[$i] ?>">
                                </li>
                                <?php
                            } else {
                                ?>
                                <li>
                                    <span><?= $i + 1 ?></span>
                                    <input type="text" placeholder="请填写可选答案">
                                </li>
                                <?php
                            }
                        }
                        ?>
                    </ul>
                </div>
                <?php
                } else {
                // 如果没有设定问题id
                $quId = false;
                ?>
                <div class="make-problem">
                    <div class="top">
                        <p class="fs36"><span>输入问题</span>
                            <input type="text"/>
                        </p>
                        <p class="clearfix"><span class="fl fs36">是否填写</span><span class="switch fr"></span></p>
                    </div>
                    <div class="bottom fs36">
                        <span>填写方式</span>
                        <div class="radio">
                            <span class="active a">单选</span>
                            <span class="b">多选</span>
                        </div>
                        <ul class="lists flex">
                            <li><span class="">1</span><input type="text" placeholder="请填写可选答案"></li>
                            <li><span>2</span><input type="text" placeholder="请填写可选答案"></li>
                            <li><span>3</span><input type="text" placeholder="请填写可选答案"></li>
                            <li><span>4</span><input type="text" placeholder="请填写可选答案"></li>
                            <li><span>5</span><input type="text" placeholder="请填写可选答案"></li>
                            <li><span>6</span><input type="text" placeholder="请填写可选答案"></li>
                            <li><span>7</span><input type="text" placeholder="请填写可选答案"></li>
                            <li><span>8</span><input type="text" placeholder="请填写可选答案"></li>
                            <li><span>9</span><input type="text" placeholder="请填写可选答案"></li>
                            <li><span>10</span><input type="text" placeholder="请填写可选答案"></li>
                        </ul>
                    </div>
                    <?php
                    }
                    ?>
                    <div class="btn">
                        <button class="btn" onclick="ajax_inputDiyQuestion(<?= $quId ?>)">
                            <a href="javascript:;">生成报名表</a>
                        </button>
                    </div>
                </div>
                <script src='./script/jquery.js'></script>
                <script src='./script/index.js'></script>
                <script type="text/javascript" src="./admin/js/jquery.xctips.js"></script>
                <script type="text/javascript">
                    //为 tips 提示框自定义 CSS,以下为默认
                    xcsoft.tipsCss = {
                        height: '44px',
                        fontSize: '16px'
                    };
                    //隐藏、显示速度 ，默认 fast
                    xcsoft.tipsHide=xcsoft.tipsShow=100;
                </script>
                <script></script>
    </body>
    </html>
<?php
require_once './footer.php';
?>